import java.io.*;

/**
 * @author zyj
 * @date 2022年05月30日 9:21
 */
public class BufferedOutputStreamDemo {
    public static void main(String[] args) {
        //创建BufferoutputStream对象
        OutputStream os = null;
        BufferedOutputStream bos = null;
        try {
            os = new FileOutputStream("a.txt",true);
            bos = new BufferedOutputStream(os);
            for (int i = 0; i < 8192; i++) {
                String name = "张三" + i;
                bos.write(name.getBytes());
                bos.flush();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                bos.close();
                os.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
